package com.example.mykotlin.model.dto

import com.example.mykotlin.base.util.Ev
import com.example.mykotlin.model.enums.Device
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size

@Schema(name = "LoginDTO", title = "用户登录信息")
data class LoginByUsernameDTO(
    @Schema(title = "用户的登录名，必须唯一且不能为空")
    @field:Pattern(regexp = "^[a-zA-Z0-9_-]{3,18}\$", message = "用户名不合法,数字、字母、_、-,3到18位")
    var username: String? = null,

    @Schema(title = "用户密码的加密哈希值，存储加密后的密码而非明文")
    @field:Size(max = 512, message = "长度不能超过512")
    @field:NotBlank(message = "不能为空")
    var password: String? = null,

    @Schema(title = "登录设备")
    @field:NotBlank(message = "不能为空")
    @field:Ev(enumClass = Device::class)
    var device: String? = null,

    )
